#ifndef DISPLAY_H
#define DISPLAY_H

#include "head.h"

//创建一个显示类，新开一个线程用于在主界面显示图像
class display:public QThread
{
    Q_OBJECT
public:
    static display* getInstance();
    ~display();
    explicit display(QObject *parent = nullptr);

protected:
    void run();

private:
    static QScopedPointer<display> self;
    QMutex mutex_parent, mutex_image, mutex_ui, mutex_count,mutex_stopped;
    volatile bool stopped;

    QObject *parent=nullptr;
    bool showImageFlag=false;
    QImage image;
    int count=0;
    Ui_visual2* ui=nullptr;

private:
    void initThread();
    void DoThread();

public slots:
    void stopThread();
    void setShowImageFlag(bool flag);
    void setImage();
    void setParent(QObject *parent);
    void setUI(Ui_visual2* ui);
};

#endif // DISPLAY_H